<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/tld/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/jstl/c" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/jstl/fn" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="ebb365,ebb365,ebb365">
<meta http-equiv="description" content="ebb365">
<title>后台图片管理</title>
<link rel="stylesheet" type="text/css" href="/admin/css/css.css">
<style type="text/css">
<!--
@import url("css/css.css");
-->
</style>
<script>
function selectAll(choice) {
	for (var i=0;i<document.theForm.xxx.length;i++) {
		var e=document.theForm.xxx[i];
		if(choice==1)e.checked=true;
		if(choice==2)e.checked=(e.checked?false:true);
		if(choice==3)e.checked=false;
	}
}

function checkForm(){

   var param = '';
   var flag = 0;
   for (var i=0;i<document.theForm.xxx.length;i++) {    
        var e=document.theForm.xxx[i];
        if(e.checked){
			flag = 1;
		}
   }
    if(flag==1){
      return confirm('确定删除吗？要确保这个图片在前面的页面没有被应用！真的确定吗？');
     }else{
        window.alert('至少选择一项!');
        return false;
   }
}
</script>
</head>
<body> 
<table width="600" cellspacing="0" cellpadding="0" border="0"  align="center" bgcolor="#cccccc">
<tbody>
<html:form action="/admin/img_add.do" enctype="multipart/form-data">
<tr>
<td align="center" valign="bottom">
选择上传目录：
<html:select property="desc">
<logic:present name="plst">
<logic:iterate id="item" name="plst">
<option value="${item}"  <c:if test="${item==pathSelected}">selected</c:if>  >${item}</option>
</logic:iterate>
</logic:present>
</html:select>
<html:file property="path"></html:file><html:submit>提交</html:submit>
</td>
</tr>
</html:form>
</tbody></table> 

<table width="600" cellspacing="0" cellpadding="2" border="0"  align="center">
<tr><td>
选择查询目录：
<select name="desc" size="1" onchange="location.href=this.options[this.selectedIndex].value;">
<logic:present name="plst">
<logic:iterate id="item_2" name="plst">
<option value="/admin/img_oper.do?desc=${item_2}"  <c:if test="${item_2==pathSelected}">selected</c:if> >${item_2}</option>
</logic:iterate>
</logic:present>
</select>
 </td></tr>
</table>

<form action="/admin/img_del.do" name="theForm" onsubmit="return checkForm();">
<table width="600" cellspacing="0" cellpadding="2" border="0"  align="center">
<tr> <logic:present name="imglist">
			<logic:iterate id="item" name="imglist" indexId="index">
			   <td align="center">
			   <html:link href="/fileUpload/${pathSelected}/${item}" target="_blank">
			   <html:img src="/fileUpload/${pathSelected}/${item}" width="100" height="120" border="0"/>
			   </html:link>
			   <br/>
			   <input name="xxx" type="checkbox" value="fileUpload/${pathSelected}/${item}">
			   </td>
		         <c:if test="${(index+1)%4==0}"> </tr><tr> </c:if>
			</logic:iterate>
	</logic:present>
</tr>
</table>
<table width="600" cellspacing="0" cellpadding="2" border="0"  align="center">
<tr><td>
<input type="button" value="全选" onclick="selectAll(1)">&nbsp;&nbsp;
<input type="button" value="反选" onclick="selectAll(2)">&nbsp;&nbsp;
<input type="button" value="不选" onclick="selectAll(3)">&nbsp;&nbsp;
<input type="submit" value="删除选中" > </td></tr>
</table>
</form>
</body>
</html:html>